# Contributor: stef <l0ls0fo2i@ctrlc.hu>
# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Bradley J Chambers <brad.chambers@gmail.com>
pkgname=eigen
pkgver=3.4.0
pkgrel=9
pkgdesc="Eigen is a C++ template library for linear algebra"
url="https://eigen.tuxfamily.org/"
arch="noarch"
license="MPL-2.0"
options="!check"  # checks take a long time, and tend to fail randomly
makedepends="
	boost-dev
	cmake
	fftw-dev
	freeglut-dev
	glu-dev
	gmp-dev
	mpfr-dev
	openblas-dev
	samurai
	suitesparse-dev
	"
subpackages="$pkgname-dev"
source="https://gitlab.com/libeigen/eigen/-/archive/$pkgver/eigen-$pkgver.tar.gz
	fftw-test-fix.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_DATADIR=/usr/lib \
		-DEIGEN_TEST_CXX11=ON
	cmake --build build
}

check() {
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

dev() {
	default_dev
	amove usr/lib/eigen3
}

sha512sums="
ba75ecb760e32acf4ceaf27115468e65d4f77c44f8d519b5a13e7940af2c03a304ad433368cb6d55431f307c5c39e2666ab41d34442db3cf441638e51f5c3b6a  eigen-3.4.0.tar.gz
c1f9d7d8c9025b4b2b3a679f80519e494f206d7bee232cd10dd45df454b1ce6697858547bc0d956a5818481d344948704db8dbb39d04ac69ff7de99961492384  fftw-test-fix.patch
"
